/*
 * G2OSummary.h
 *
 *  Created on: Sep 11, 2016
 *      Author: ubuntu
 */

#ifndef G2O_G2OSUMMARY_H_
#define G2O_G2OSUMMARY_H_

#include "G2OParse.h"
#include "../Summary.h"
#include <mysql++/mysql++.h>
using namespace mysqlpp;

class G2OSummary : public Summary{
public:
	G2OSummary();
	virtual ~G2OSummary();

	virtual void getBuf(unsigned char *buf, size_t len);
	virtual void parse();
	virtual void parseBuf(unsigned char *buf, size_t len);
	virtual void writeDB(Connection *);
	virtual void createTB(Connection *);
	virtual void debugInfo();

protected:

private:
	void write_login(Connection *pConn);
	void write_gps(Connection *pConn);
	void write_data_stream(Connection *pConn);
	void write_config_info(Connection *pConn);
	void write_warn_msg(Connection *pConn);
	void write_travel_stcs(Connection *pConn);
	void write_beat_data(Connection *pConn);
	void write_upgrade(Connection *pConn);

	void create_login(Connection *pConn);
	void create_gps(Connection *pConn);
	void create_data_stream(Connection *pConn);
	void create_config_info(Connection *pConn);
	void create_warn_msg(Connection *pConn);
	void create_travel_stcs(Connection *pConn);
	void create_beat_data(Connection *pConn);
	void create_upgrade(Connection *pConn);

private:
	unsigned char *m_pbuf;
	struct g2o_msg msg;
	size_t m_len;
	char m_obdid[13];
	char szDay[30];
	char szMonth[30];
	char szYear[30];
};

#endif /* G2O_G2OSUMMARY_H_ */
